from typing import Mapping
from langchain_openai import ChatOpenAI

__all__ = ["Qwen"]

class Qwen:
    def __init__(self, model, api_key):
        self.chat = ChatOpenAI(
            model=model,
            api_key=api_key,
            base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",
        )

    def ask(self, question: str) -> Mapping:
        return self.chat.invoke(question)

